package com.example.mrzhou.lvmm.view.activity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;

import com.example.mrzhou.lvmm.R;
import com.example.mrzhou.lvmm.commom.utils.BottomBarTabUtils;
import com.example.mrzhou.lvmm.view.fragment.destination.DestinationFragment;
import com.example.mrzhou.lvmm.view.fragment.home.HomeFragment;
import com.example.mrzhou.lvmm.view.fragment.surround.SurroundFragment;
import com.example.mrzhou.lvmm.view.fragment.tm.TMFragment;
import com.example.mrzhou.lvmm.view.fragment.us.UsFragment;
import com.roughike.bottombar.BottomBar;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class MainActivity extends AppCompatActivity {

    @BindView(R.id.bottomBar)
    BottomBar bottomBar;
    List<Fragment> fragments;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        initView();
    }

    private void initView() {
        ButterKnife.bind(this);
        initData();
        BottomBarTabUtils.getInstance().tabUtils(getSupportFragmentManager(), bottomBar, fragments, R.id.fl_main);
    }

    private void initData() {
        fragments = new ArrayList<>();
        fragments.add(HomeFragment.newInstance());
        fragments.add(TMFragment.newInstance());
        fragments.add(DestinationFragment.newInstance());
        fragments.add(SurroundFragment.newInstance());
        fragments.add(UsFragment.newInstance());
    }

}
